set guioptions=ce
set antialias
"colorscheme rails_envy
set linespace=2

if has("gui_macvim")
  set transparency=0

  " disable IM while leaving insert mode
  "autocmd InsertEnter * set noimdisable
  "autocmd InsertLeave * set imdisable

  " move a line of text using ALT+[jk] or Comamnd+[jk] on mac
  nmap <D-j> mz:m+<cr>`z
  nmap <D-k> mz:m-2<cr>`z
  vmap <D-j> :m'>+<cr>`<my`>mzgv`yo`z
  vmap <D-k> :m'<-2<cr>`>my`<mzgv`yo`z

  " disable default menu hot key
  macmenu &File.New\ Window key=<nop>
  "macmenu &File.Close key=<nop>

  " remap cmd + w to close tab
  "map <D-w> :tabclose<CR>

  " remap cmd + n to new tab
  map <D-n> :tabnew<CR>

  " map cmd + enter to switch to full screen
  map <D-Enter> :set invfu<CR>
  map <F11> :set invfu<CR>

  " map cmd+1~9 to switch tab 1~9
  for i in range(1, 9)
    exec "nnoremap <D-".i."> ".i."gt"
  endfor
  colorscheme freya

endif
if has("gui_running")
  "set guifont=Monaco\ for\ Powerline:h1
  set guifont=Source\ Code\ Pro:h18
  set guifontwide=Times:h18
  "set lines=40 columns=100

endif
let g:Powerline_symbols = 'fancy'
set wildmode=longest:full " 补全行为设置
set wildmenu "命令行补全以增强模式运行
set viminfo='1000,\"100,:100,%,n~/.viminfo
"au BufReadPost * if line("'\"") > 0|if line("'\"") <=line("$")|exe("norm'\"")|else|exe "norm $"|endif|endif
" When editing a file, always jump to the last known cursor position.
 " Don't do it when the position is invalid or when inside an event handler
 " (happens when dropping a file on gvim).
 " 记住上次的编辑位置
"autocmd BufReadPost *
    "\ if line("'\"") > 0 && line("'\"") <= line("$") |
    "\   exe "normal g`\"" |
    "\ endif

 " 打开文件时，按照 viminfo 保存的上次关闭时的光标位置重新设置光标
au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif

